<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>回传记录添加</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <style>
        .layui-form-label{ width: 121px; }
        .layui-input-block{ margin-left: 152px;}
    </style>
</head>
<body>

<div class="layui-form" style="padding: 20px 30px 0 0;">

    {neq name="role_name" value="channel"}
    <div class="layui-form-item">
        <label class="layui-form-label">所属渠道</label>
        <div class="layui-input-block">
            <select name="channel_id" lay-search lay-verify="channel_id" lay-verType="tips" lay-filter="channel_switch">
                <option value="0"></option>
                {foreach $channels as $k => $v}
                <option value="{$v.id}">{$v.account}</option>
                {/foreach}
            </select>
        </div>
    </div>
    {/neq}

    <div class="layui-form-item">
        <label class="layui-form-label">投放媒体</label>
        <div class="layui-input-block">
            <select name="advert_media_id" lay-verify="advert_media_id" lay-verType="tips">
                <option value="0"></option>
                {foreach $advert_medias as $k => $v}
                <option value="{$k}">{$v}</option>
                {/foreach}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">上报激活行为</label>
        <div class="layui-input-block">
            <input type="radio" name="report_ab" value="2" title="上报注册行为">
            <input type="radio" name="report_ab" value="3" title="否" checked>
        </div>
        <div class="layui-form-mid layui-word-aux" style="margin-left: 156px;">百度无需上报激活行为，注册行为：用户进入App生成用户id</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">上报活动订单</label>
        <div class="layui-input-block">
            <input type="radio" name="report_ao" value="1" title="是">
            <input type="radio" name="report_ao" value="2" title="否" checked>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">上报口径</label>
        <div class="layui-input-block">
            {volist name="report_caliber_list" key="k" id="v"}
            <input type="radio" name="report_caliber" value="{$k}" title="{$v}">
            {/volist}
        </div>
    </div>

    <div class="layui-form-item" style="display: flex;margin-bottom: 0;">
        <div class="layui-form-item" style="margin-bottom: 0;">
            <label class="layui-form-label">X =</label>
            <div class="layui-input-block" style="line-height: 38px;width: 184px;">
                <input style="width: 80px;float: left" type="text" name="hourValue" value="24" placeholder="请输入" autocomplete="off" lay-verify="hourValue" lay-verType="tips" class="layui-input" />&nbsp;小时
            </div>
        </div>

        <div class="layui-form-item" style="margin-bottom: 0;margin-left: -74px;">
            <label class="layui-form-label" style="width: 38px !important;">Y =</label>
            <div class="layui-input-block" style="line-height: 38px;width: 184px;margin-left: 28px;">
                <input style="width: 80px;float: left" type="text" name="order_amount_below" value="0" placeholder="请输入" autocomplete="off" class="layui-input" />&nbsp;元
            </div>
        </div>

        <div class="layui-form-item" style="margin-bottom: 0;margin-left: -47px;">
            <label class="layui-form-label"  style="width: 38px !important;">Z =</label>
            <div class="layui-input-block" style="line-height: 38px;width: 184px;margin-left: 28px;">
                <input style="width: 80px;float: left" type="text" name="order_amount_above" value="1000" placeholder="请输入" autocomplete="off" class="layui-input" />&nbsp;元
            </div>
        </div>

    </div>

    <div class="layui-form-mid layui-word-aux" style="margin-left: 156px;">注：X为1-72之间的整数</div>

    <div class="layui-form-item">
        <label class="layui-form-label">VIP会员订单</label>
        <div class="layui-input-block">
            <input type="radio" name="vip_order_switch" value="2" title="回传">
            <input type="radio" name="vip_order_switch" value="1" title="不回传" checked>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">全量回传</label>
        <div class="layui-input-block">
            <input type="radio" name="report_full" value="1" title="是" lay-filter="report_full_switch">
            <input type="radio" name="report_full" value="2" title="否" checked lay-filter="report_full_switch">
        </div>
    </div>

    <div class="layui-form-item report_unfull_block todayRef">
        <label class="layui-form-label">订单回传(前N笔)</label>
        <div class="layui-input-block">
            <input type="text" name="report_order_bn" placeholder="请输入订单回传(前N笔)数值" autocomplete="off" class="layui-input" />
            <div class="layui-form-mid layui-word-aux">当日0点清零，重新计数</div>
        </div>
    </div>

    <div class="layui-form-item report_unfull_block">
        <label class="layui-form-label">漏报方式</label>
        <div class="layui-input-block">
            <input type="radio" name="misreporting_type" value="1" title="百分比" checked lay-filter="misreporting_type_switch">
            <input type="radio" name="misreporting_type" value="2" title="循环比例" lay-filter="misreporting_type_switch">
        </div>
    </div>

    <div class="layui-form-item report_unfull_block1">
        <label class="layui-form-label">百分比%</label>
        <div class="layui-input-block">
            <input type="text" name="misreporting_percentage" placeholder="请输入订单回传比例" autocomplete="off" class="layui-input" />
        </div>
    </div>

    <div class="layui-form-item report_unfull_block2 todayRef" style="display: none">
        <label class="layui-form-label">循环比例</label>
        <div class="layui-input-block">
            <select name="misreporting_loop_proportion">
                <option value=""></option>
                {foreach $loop_ratios as $v}
                <option value="{$v}">{$v}</option>
                {/foreach}
            </select>
            <div class="layui-form-mid layui-word-aux">当日0点清零，重新计数</div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">启用状态</label>
        <div class="layui-input-block">
            <input type="radio" name="status" value="1" title="是">
            <input type="radio" name="status" value="2" title="否" checked>
        </div>
    </div>

    <div class="layui-form-item layui-hide">
        <button class="layui-btn" lay-submit lay-filter="LAY-data-add-submit" id="LAY-data-add-submit">提交</button>
    </div>
</div>
<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index', //主入口模块
        xmSelect: 'xmSelect/xm-select'
    }).use(['index', 'form','xmSelect'], function(){
        var $ = layui.$
            ,form = layui.form
            ,xmSelect = layui.xmSelect;

        var misreporting_type = 1;
        /*var report_jb = 2;
        var report_rb = 2;

        form.on('radio(report_jb_switch)', function(data){
            if(data.value == 1 && report_rb == 1)
            {
                layer.msg('上报激活行为只能选择一个',function () {
                    $('.report_jb_2').prop('checked', true)
                    form.render('radio');
                });

            }
            report_jb = data.value;
        });

        form.on('radio(report_rb_switch)', function(data){
            if(data.value == 1 && report_jb == 1)
            {
                layer.msg('上报激活行为只能选择一个',function () {
                    $('.report_rb_2').prop('checked', true)
                    form.render('radio');
                });
            }
            report_rb = data.value;
        });*/


        form.on('radio(misreporting_type_switch)', function(data){
            if(data.value == 1)
            {
                $('.report_unfull_block1').show();
                $('.report_unfull_block2').hide();
            }else{
                $('.report_unfull_block1').hide();
                $('.report_unfull_block2').show();
            }
            misreporting_type = data.value;
        });

        form.on('radio(report_full_switch)', function(data){
            if(data.value == 1)
            {
                $('.report_unfull_block').hide();
                $('.report_unfull_block1').hide();
                $('.report_unfull_block2').hide();
            }else{
                $('.report_unfull_block').show();
                if(misreporting_type == 1)
                {
                    $('.report_unfull_block1').show();
                }else{
                    $('.report_unfull_block2').show();
                }
            }
        });

        form.verify({

            channel_id: function (value) {
                if(value < 1){
                    return '请选择所属渠道';
                }
            },
            advert_media_id: function (value) {
                if(value < 1){
                    return '请选择投放媒体';
                }
            },
            link_id: function (value) {
                if(value < 1){
                    return '请选择推广链接';
                }
            },
            hourValue: function (value) {
                if(value < 1 || value > 72){
                    return '请输入1-72之间的整数';
                }
            }

        });

    })

</script>
</body>
</html>